from .base import BaseConfig
from lib.conf.config import settings


class Board(BaseConfig):

    def process(self, command_func, debug):
        if debug:
            output = {
                'manufacturer': '	Manufacturer: Dell Inc.   '.split(':')[1].strip(),
                'product_name': '	Product Name: PowerEdge R520   '.split(':')[1].strip(),
                'serial_number': '	Serial Number: 4JVYQ2X  '.split(':')[1].strip(),
            }
        else:
            output = {
                # 获取服务器的生产厂商
                'manufacturer': command_func("dmidecode -t1 | grep 'Manufacturer'").split(':')[1].strip(),
                # 获取当前服务器的型号
                'product_name': command_func("dmidecode -t1 | grep 'Product Name'").split(':')[1].strip(),
                # 获取服务器的SN码
                'serial_number': command_func("dmidecode -t1 | grep 'Serial Number'").split(':')[1].strip()
            }
        return output
